/**
 * JFinal配置类
 */
package com.itcaicai.config;

import com.itcaicai.controller.IndexController;
import com.itcaicai.model.Clinic_appoints;
import com.itcaicai.model.MovieInfo;
import com.itcaicai.model.Test;
import com.jfinal.config.Constants;
import com.jfinal.config.Handlers;
import com.jfinal.config.Interceptors;
import com.jfinal.config.JFinalConfig;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.activerecord.CaseInsensitiveContainerFactory;
import com.jfinal.plugin.activerecord.dialect.OracleDialect;
import com.jfinal.plugin.c3p0.C3p0Plugin;
import com.jfinal.render.ViewType;

/**
 * @author icer
 *
 */
public class MainConfig extends JFinalConfig{

	@Override
	public void configConstant(Constants me) {
		me.setDevMode(true);
		me.setEncoding("UTF-8");
		me.setViewType(ViewType.JSP);
	}

	@Override
	public void configRoute(Routes me) {
		me.add("/", IndexController.class);
	}

	@Override
	public void configPlugin(Plugins me) {
		C3p0Plugin cp = new C3p0Plugin("jdbc:mysql://localhost/moviemgr", "root", "1");
                C3p0Plugin cpora = new C3p0Plugin("jdbc:oracle:thin:@172.16.81.150:1521:oracle11","system", "manager");
                cpora.setDriverClass("oracle.jdbc.driver.OracleDriver");
		me.add(cp);
                me.add(cpora);
		ActiveRecordPlugin arp = new ActiveRecordPlugin("mysql",cp);
                ActiveRecordPlugin arpora = new ActiveRecordPlugin("oracle",cpora);
		me.add(arp);
                me.add(arpora);
                arpora.setDialect(new OracleDialect());
        // 配置属性名(字段名)大小写不敏感容器工厂
        arpora.setContainerFactory(new CaseInsensitiveContainerFactory());
        arp.addMapping("itcc_movie_info", MovieInfo.class);
        arpora.addMapping("clinic_appoints","CLINIC_LABEL,VISIT_DATE_APPTED,VISIT_TIME_APPTED,SERIAL_NO",Clinic_appoints.class);
                arpora.addMapping("TEST"," CLINIC_LABEL,VISIT_DATE_APPTED, VISIT_TIME_APPTED, SERIAL_NO",Test.class);  
        //arpora.addMapping("test","aa", Test.class);
	}

	@Override
	public void configInterceptor(Interceptors me) {
	}

	@Override
	public void configHandler(Handlers me) {
	}
	
}
